$(function(){
	$("#btnVerificationCode").on('click',function(obj){
		getVerificationCode();
	});
	$("#btnSure").on('click',function(obj){
		submitMes();
	});
	$("#btnSubmit").on('click',function(obj){
		submitPD();
	});
});
/*获取验证码*/
function getVerificationCode(){
	var memberMobile=$("#memberMobile").val().trim();
	if(memberMobile==null || memberMobile==""){
		consoleMes($("#webContent"),2000,"warning","请输入手机！");
		return;
	}
	if(!ischeckmobile(memberMobile)){
		consoleMes($("#webContent"),2000,"warning","手机格式不正确！");
		return;
	}
	consoleMes($("#webContent"),2000,"success","验证码已经发送至手机！");//success、info、warning、danger
	/*$.ajax({
        type: "GET",
        url:  gobalWebUrl+"member/login",
        async: true,//false使用同步的方式,true为异步方式
        contentType: "application/json; charset=utf-8",
        data:{"count":memberMobile},
        dataType: "json",
        success:function(backData){
            if(backData.result==202){
            	consoleMes($("#webContent"),2000,"success",backData.message);//success、info、warning、danger
            }else{
            	consoleMes($("#webContent"),2000,"warning",backData.message);//success、info、warning、danger
            	
            }
        },
        error:function(backData){

        }

    });*/
}
/*提交手机和验证码*/
function submitMes(){
	var memberMobile=$("#memberMobile").val().trim();
	var verificationCode=$("#verificationCode").val().trim();
	if(memberMobile==null || memberMobile==""){
		consoleMes($("#webContent"),2000,"warning","请输入手机！");
		return;
	}
	if(!ischeckmobile(memberMobile)){
		consoleMes($("#webContent"),2000,"warning","手机格式不正确！");
		return;
	}
	if(verificationCode==null || verificationCode==""){
		consoleMes($("#webContent"),2000,"warning","请输入验证码！");
		return;
	}
	if(verificationCode!="666"){
		consoleMes($("#webContent"),2000,"warning","验证码不正确！");
		return;
	}
	consoleMes($("#webContent"),2000,"success","正在跳转密码修改！");//success、info、warning、danger
	setTimeout(function () {
    	$("#verificationCodePanel").hide();
    	$("#pdSetPanel").show();
    }, 2500);
	/*$.ajax({
        type: "GET",
        url:  gobalWebUrl+"member/login",
        async: true,//false使用同步的方式,true为异步方式
        contentType: "application/json; charset=utf-8",
        data:{"count":memberMobile},
        dataType: "json",
        success:function(backData){
            if(backData.result==202){
            	consoleMes($("#webContent"),2000,"success",backData.message);//success、info、warning、danger
            }else{
            	consoleMes($("#webContent"),2000,"warning",backData.message);//success、info、warning、danger
            	
            }
        },
        error:function(backData){

        }

    });*/
}
/*提交修改密码*/
function submitPD(){
	var newMemberPassword=$("#newMemberPassword").val().trim();
	var repeatMemberPassword=$("#repeatMemberPassword").val().trim();
	if(newMemberPassword==null || newMemberPassword=="" || newMemberPassword.length<6){
		consoleMes($("#webContent"),2000,"warning","密码不能为空，且长度须不小于6位！");
		return;
	}
	if(newMemberPassword!=repeatMemberPassword){
		consoleMes($("#webContent"),2000,"warning","两次密码输入不一致！");
		return;
	}
	consoleMes($("#webContent"),2000,"success","密码修改成功，正在跳转登录页面！");//success、info、warning、danger
	setTimeout(function () {
    	window.location.href=gobalWeb+"login.html";
    }, 2500);
	/*$.ajax({
        type: "GET",
        url:  gobalWebUrl+"member/login",
        async: true,//false使用同步的方式,true为异步方式
        contentType: "application/json; charset=utf-8",
        data:{"count":memberMobile},
        dataType: "json",
        success:function(backData){
            if(backData.result==202){
            	consoleMes($("#webContent"),2000,"success",backData.message);//success、info、warning、danger
            }else{
            	consoleMes($("#webContent"),2000,"warning",backData.message);//success、info、warning、danger
            	
            }
        },
        error:function(backData){

        }

    });*/
}